package net.lab1024.sa.admin.module.business.erp.sao.controller;

import net.lab1024.sa.admin.module.business.erp.sao.domain.form.SnordAddForm;
import net.lab1024.sa.admin.module.business.erp.sao.domain.form.SnordQueryForm;
import net.lab1024.sa.admin.module.business.erp.sao.domain.form.SnordUpdateForm;
import net.lab1024.sa.admin.module.business.erp.sao.domain.vo.SnordVO;
import net.lab1024.sa.admin.module.business.erp.sao.service.SnordService;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 发货通知单 Controller
 *
 * @Author AKITA
 * @Date 2025-08-26 15:00:19
 * @Copyright AKITA
 */

@RestController
@Tag(name = "发货通知单")
public class SnordController {

    @Resource
    private SnordService snordService;

    @Operation(summary = "分页查询 @author AKITA")
    @PostMapping("/snord/queryPage")
    public ResponseDTO<PageResult<SnordVO>> queryPage(@RequestBody @Valid SnordQueryForm queryForm) {
        return ResponseDTO.ok(snordService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author AKITA")
    @PostMapping("/snord/add")
    public ResponseDTO<Long> add(@RequestBody @Valid SnordAddForm addForm) {
        return snordService.add(addForm);
    }

    @Operation(summary = "更新 @author AKITA")
    @PostMapping("/snord/update")
    public ResponseDTO<String> update(@RequestBody @Valid SnordUpdateForm updateForm) {
        return snordService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author AKITA")
    @PostMapping("/snord/batchDelete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return snordService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author AKITA")
    @GetMapping("/snord/delete/{id}")
    public ResponseDTO<String> batchDelete(@PathVariable Long id) {
        return snordService.delete(id);
    }



    @Operation(summary = "单个查询 @author AKITA")
    @GetMapping("/snord/info/{docEntry}")
    public ResponseDTO<SnordVO> info(@PathVariable Long docEntry) {
        return snordService.info(docEntry);
    }

    @Operation(summary = "单个查询 @author AKITA")
    @GetMapping("/snord/infoUnexecute/{id}")
    public ResponseDTO<SnordVO> infoUnexecute(@PathVariable Long id) {
        return snordService.infoUnexecute(id);
    }
}
